using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableTalentDao:DaoBase<TableTalent>
    {
        public override void AddPrimaryIndex(TableTalent model)
        {
            cachePrimary[model.Id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableTalent.txt";
        }

        protected override TableTalent ParseRowData(string[] rowData)
        {
            TableTalent data = new TableTalent();
			data.Id = rowData [0];
			data.Group = rowData [1];
			data.Name = rowData [2];
			data.Desc = rowData [3];
			data.ImmuneTalentGroup = rowData [4];
			data.ImmuneBuffGroup = rowData [5];

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.Buff0TriggerTimer = 0;
            }
            else
            {
                data.Buff0TriggerTimer = int.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.Buff0TriggerCondition = 0;
            }
            else
            {
                data.Buff0TriggerCondition = int.Parse(rowData[7]);
            }
			data.Buff0ConditionArgs = rowData [8];
			data.Buff0 = rowData [9];

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.Buff0Select = 0;
            }
            else
            {
                data.Buff0Select = int.Parse(rowData[10]);
            }

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.Buff0Percent = 0;
            }
            else
            {
                data.Buff0Percent = double.Parse(rowData[11]);
            }

            if (string.IsNullOrEmpty(rowData[12]))
            {
                data.Buff1TriggerTimer = 0;
            }
            else
            {
                data.Buff1TriggerTimer = int.Parse(rowData[12]);
            }

            if (string.IsNullOrEmpty(rowData[13]))
            {
                data.Buff1TriggerCondition = 0;
            }
            else
            {
                data.Buff1TriggerCondition = int.Parse(rowData[13]);
            }
			data.Buff1ConditionArgs = rowData [14];
			data.Buff1 = rowData [15];

            if (string.IsNullOrEmpty(rowData[16]))
            {
                data.Buff1Select = 0;
            }
            else
            {
                data.Buff1Select = int.Parse(rowData[16]);
            }

            if (string.IsNullOrEmpty(rowData[17]))
            {
                data.Buff1Percent = 0;
            }
            else
            {
                data.Buff1Percent = double.Parse(rowData[17]);
            }

            if (string.IsNullOrEmpty(rowData[18]))
            {
                data.Buff2TriggerTimer = 0;
            }
            else
            {
                data.Buff2TriggerTimer = int.Parse(rowData[18]);
            }

            if (string.IsNullOrEmpty(rowData[19]))
            {
                data.Buff2TriggerCondition = 0;
            }
            else
            {
                data.Buff2TriggerCondition = int.Parse(rowData[19]);
            }
			data.Buff2ConditionArgs = rowData [20];
			data.Buff2 = rowData [21];

            if (string.IsNullOrEmpty(rowData[22]))
            {
                data.Buff2Select = 0;
            }
            else
            {
                data.Buff2Select = int.Parse(rowData[22]);
            }

            if (string.IsNullOrEmpty(rowData[23]))
            {
                data.Buff2Percent = 0;
            }
            else
            {
                data.Buff2Percent = double.Parse(rowData[23]);
            }

            if (string.IsNullOrEmpty(rowData[24]))
            {
                data.Buff3TriggerTimer = 0;
            }
            else
            {
                data.Buff3TriggerTimer = int.Parse(rowData[24]);
            }

            if (string.IsNullOrEmpty(rowData[25]))
            {
                data.Buff3TriggerCondition = 0;
            }
            else
            {
                data.Buff3TriggerCondition = int.Parse(rowData[25]);
            }
			data.Buff3ConditionArgs = rowData [26];
			data.Buff3 = rowData [27];

            if (string.IsNullOrEmpty(rowData[28]))
            {
                data.Buff3Select = 0;
            }
            else
            {
                data.Buff3Select = int.Parse(rowData[28]);
            }

            if (string.IsNullOrEmpty(rowData[29]))
            {
                data.Buff3Percent = 0;
            }
            else
            {
                data.Buff3Percent = double.Parse(rowData[29]);
            }

            return data;
        }



    }

}
